#ifndef ECARX_NET_ITRANSFER_H_
#define ECARX_NET_ITRANSFER_H_

#include <functional>
#include <optional>
#include "common.h"
namespace ecarx::transfer {

enum class NetState {
  INIT = 1,
  Open,
  Ready,
  Close,
};

using NetStateCallback = std::function<void(NetState)>;
using SignalChangeCallback = std::function<void(const std::vector<int32_t> &)>;
class ITransfer {
 public:
  virtual ~ITransfer() {}
  virtual bool open() = 0;
  virtual bool close() = 0;
  virtual bool write(const Signal &) = 0;
  virtual const std::optional<Signal> read(const int32_t signalId) const =0;
  virtual NetState getState() = 0;
  virtual void registerStateHandler(NetStateCallback&& callback) = 0;
  virtual void onSignalChanged(SignalChangeCallback && callback) = 0;
  virtual bool enterStrMode() { return true; };
  virtual bool exitStrMode() { return true; };
};
}  // namespace ecarx::transfer
#endif
